import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/Home'),
    children:[
      {
        path: "",//自动进入时,让路由重定向
        redirect:"/home/index",
      },
      {
        path: '/home/index',
        name: 'HomeIndex',
        component: () => import('../views/Home/HomeIndex')
      },

      {
        path: '/home/bookstore',
        name: 'BookStore',
        component: () => import('../views/Home/BookStore')
      },
      {
        path: '/home/newbook',
        name: 'NewBook`',
        component: () => import('../views/Home/NewBook')
      },
      {
        path: '/home/booknotice',
        name: 'BookNotice`',
        component: () => import('../views/Home/BookNotice')
      },
      {
        path: '/home/rule',
        name: 'HomeRule',
        component: () => import('../views/Home/HomeRule')
      },
    ]
  },
  {
    path: '/',
    name: 'Login',
    component: () => import('../views/Login')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register')
  },
  {
    path: '/persondetail',
    name:'PersonDetail',
    component: ()=>import('../views/PersonalDetail')
  },
  {
    path: '/blankpage',
    name:'BlankPage',
    component: ()=>import('../views/BlankPage')
  },
  {
    path: '/bookdetail/:isbn',
    name:'BookDetail',
    component: ()=>import('../views/BookDetails')
  },
  //公告详情页
  {
    path: '/home/details',
    name: 'HomeDetails',
    component: () => import('../views/Home/HomeDetails')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
